sil-openclaw 0.4.6 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/README.md +34 -46
  3. package/SECURITY.md +61 -11
  4. package/dist/gateway/search-results.js +11 -7
  5. package/dist/index.js +24 -24
  6. package/dist/lib/allowlist-script.js +13 -0
  7. package/dist/lib/artifacts.js +30 -0
  8. package/dist/lib/credentials.js +2 -3
  9. package/dist/lib/host-wiring.js +44 -15
  10. package/dist/lib/pkce.js +3 -3
  11. package/dist/lib/search-results-log.js +23 -0
  12. package/dist/lib/search-results-store.js +4 -4
  13. package/dist/lib/shopping-call.js +143 -0
  14. package/dist/lib/sil-client.js +185 -1046
  15. package/dist/lib/tool-result.js +10 -3
  16. package/dist/tools/catalog.js +311 -1197
  17. package/dist/tools/doctor.js +25 -63
  18. package/dist/tools/identity.js +110 -245
  19. package/openclaw.plugin.json +12 -33
  20. package/package.json +10 -9
  21. package/schema/PROVENANCE.md +15 -0
  22. package/schema/shopping-brief-create-request.schema.json +98 -0
  23. package/schema/shopping-brief-create-response.schema.json +24 -0
  24. package/schema/shopping-brief-edit-request.schema.json +125 -0
  25. package/schema/shopping-brief-edit-response.schema.json +24 -0
  26. package/schema/shopping-brief-read-request.schema.json +15 -0
  27. package/schema/shopping-brief-read-response.schema.json +235 -0
  28. package/schema/shopping-domain-create-request.schema.json +160 -0
  29. package/schema/shopping-domain-create-response.schema.json +60 -0
  30. package/schema/shopping-domain-get-request.schema.json +18 -0
  31. package/schema/shopping-domain-get-response.schema.json +307 -0
  32. package/schema/shopping-domain-search-request.schema.json +18 -0
  33. package/schema/shopping-domain-search-response.schema.json +92 -0
  34. package/schema/shopping-offers-request.schema.json +31 -0
  35. package/schema/shopping-offers-response.schema.json +172 -0
  36. package/schema/shopping-product-get-request.schema.json +24 -0
  37. package/schema/shopping-product-get-response.schema.json +121 -0
  38. package/schema/shopping-profile-edit-request.schema.json +97 -0
  39. package/schema/shopping-profile-edit-response.schema.json +17 -0
  40. package/schema/shopping-search-request.schema.json +106 -0
  41. package/schema/shopping-search-response.schema.json +182 -0
  42. package/schema/shopping-seller-get-request.schema.json +24 -0
  43. package/schema/shopping-seller-get-response.schema.json +342 -0
  44. package/scripts/allowlist-openclaw.mjs +6 -7
  45. package/sil-shopping/SKILL.md +196 -97
  46. package/sil-shopping/references/mint.md +190 -0
  47. package/dist/lib/bind-channel.js +0 -10
  48. package/dist/lib/creation-entrypoint.js +0 -111
  49. package/dist/lib/derive-agent-id.js +0 -36
  50. package/dist/lib/profile-store.js +0 -568
  51. package/dist/tools/profile.js +0 -300
  52. package/scripts/create-shopper.mjs +0 -677
  53. package/sil-shopping/examples/multi_domain_shopper_walkthrough.md +0 -65
  54. package/sil-shopping/references/agent_creation_engine.md +0 -223
  55. package/sil-shopping/references/fill_and_feedback.md +0 -102
  56. package/sil-shopping/references/method_and_prds.md +0 -143
  57. package/sil-shopping/references/setup_onboarding.md +0 -64
  58. package/sil-shopping/references/shop_loop.md +0 -118
package/CHANGELOG.md CHANGED
@@ -10,6 +10,191 @@ release (`clawhub package publish --changelog`). See [README](./README.md#releas
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.5.1] - 2026-09-30
14
+
15
+ ### Changed
16
+
17
+ - **Host floor raised to OpenClaw `>=2026.9.3`**, the version the plugin is built
18
+ and tested against (`compat.pluginApi`, `compat.minGatewayVersion`,
19
+ `install.minHostVersion`). An older host refuses the plugin; update OpenClaw first.
20
+ - **The security declaration moved from `openclaw.plugin.json#security` to
21
+ `SECURITY.md`.** The manifest has no such field (ClawHub `manifest-unknown-fields`).
22
+ Same claims: network endpoints, filesystem scope, credentials, timers, processes.
23
+ - SDK types now import from the `openclaw/plugin-sdk/plugin-entry` subpath instead
24
+ of the legacy root barrel (ClawHub `legacy-root-sdk-import`). Type-only, no
25
+ runtime change.
26
+
27
+ ## [0.5.0] - 2026-09-25
28
+
29
+ ### Added
30
+
31
+ - **The eleven `shopping_*` tools, on the agent contract.** 1:1 with the sil-api routes —
32
+ `shopping_domain_search` (read the registry in the buyer's words),
33
+ `shopping_domain_get` (a category's buying guide and the keys it is bought by),
34
+ `shopping_domain_create` (coin a new one), `shopping_search`, `shopping_product_get`
35
+ (the whole dossier on 1–10 variants), `shopping_offers` (dated prices and the brief's
36
+ seller terms, per offer, read live) and `shopping_seller_get` (one seller's
37
+ whole terms). Every tool the loop calls is named for what it does for the shopper;
38
+ only `sil_register`, `sil_whoami` and `sil_doctor` keep the `sil_` name.
39
+ - **The brief and the profile are tools now: `shopping_brief_create`,
40
+ `shopping_brief_edit`, `shopping_brief_read` and `shopping_profile_edit`.** One brief
41
+ per session, held in sil under the buyer's account and named by `brief` on every
42
+ search and offers call: a title, a narrative in their own terms, the product specs by
43
+ category and the seller specs under `seller`, and the `decision` sentence behind each
44
+ change. A spec is `key · op · value · currency? · reason?` — there is no hard or soft
45
+ on it, and a want no spec can carry stays in the narrative. `shopping_brief_read` with
46
+ no `id` lists the buyer's briefs, newest first, which is what a new chat opens on.
47
+ `shopping_profile_edit` writes what is true of them whatever they buy — a measurement
48
+ with its unit, a size as printed, a lasting taste, the `currency` they price in — and an
49
+ entry replaces the one of the same `name`.
50
+ - **`sil_whoami` answers the buyer's `measurements`, `preferences` and `currency`**, beside
51
+ the name, country and addresses, so a foot length written last session is never asked
52
+ for again. A money row on the brief or a search that names no currency means theirs;
53
+ sil converts nothing, so a new currency changes which offers come first, never a price.
54
+ - **The twenty-two schema artifacts, in `schema/`.** Each shopping tool's `parameters` IS
55
+ its committed request artifact, copied verbatim from `sil-services`
56
+ (`schema/PROVENANCE.md` names the commit), and each `ok` result IS the API's 200 body,
57
+ handed over untouched. The plugin adds no shape of its own in either direction, so
58
+ there is nothing here for the contract to drift from.
59
+ - **`ship_to` is the LABEL of an address the buyer has on file**, as `sil_whoami` lists
60
+ them — never a country. It localizes a search to that address; absent, sil uses the
61
+ buyer's default address. `shopping_offers` and `shopping_seller_get` take no address:
62
+ their `ships` answers for the default one.
63
+ - **Seller terms live on the brief, are answered per OFFER, and are never coined by the
64
+ agent.** `shopping_offers` takes the brief's id and the picked variant ids and nothing
65
+ else: sil reads the brief's `seller` specs — keys of the domain read's own
66
+ `seller_specs`, sil's base plus whatever branch research has coined — its price ceiling,
67
+ and the buyer's default address and currency, looks on the web for shops it does not
68
+ hold, and answers `seller_fit` on each offer: `ships` always (serviceable,
69
+ not_serviceable or unknown for that address), plus each seller key on the brief with that
70
+ seller's value where sil holds one. Offers in the buyer's currency and market come
71
+ first. `shopping_seller_get` is the details read beside it, carrying every seller key sil
72
+ holds as `specs`.
73
+ - **A key the domain does not hold is recorded, never refused.** The search takes any
74
+ well-formed key, answers the products it found and leaves that key absent from `fit`,
75
+ writing the ask on the search row so research can coin what buyers need. The skill keeps
76
+ it in the brief exactly as the buyer stated it and sends it with every other spec.
77
+ - **`shopping_domain_create` coins PRODUCT keys, marked `variant_spec` or
78
+ `product_spec`** — what identifies a purchasable variant, and what tells one product
79
+ from the next. The registry derives each key's operators from its `type`. A key an
80
+ ancestor already defines with the same type and unit is not coined again: the mint
81
+ answers `ok` and reports it `inherited: true`, so the agent may filter on it.
82
+ - **The skill drives one loop over the brief sil holds, and every tool it names now
83
+ answers.** Every chat opens on `sil_whoami` and a bare `shopping_brief_read`, so a
84
+ size, a width, a budget or a market already on file is never asked again. Then: settle the category, write every want as a
85
+ spec and every lasting fact to the profile **before** the next search, find the products
86
+ that fit the brief's product specs, price them and read the sellers against its seller
87
+ specs, and — when nothing fits — name the spec in the way, propose ONE relaxation, wait,
88
+ and write the buyer's word as a spec plus the one-sentence `decision` that says why.
89
+ One brief per conversation, never one per category.
90
+
91
+ ### Changed
92
+
93
+ - The sil-api request timeout is 45 s (was 15 s): a live cold search outlives 15 s, and the plugin
94
+ answered "sil is temporarily unavailable" while sil-api finished the leg and wrote the row.
95
+ - **BREAKING — `sil_register` answers `open`, and the session travels in the PATH.**
96
+ `<sil-web>/authorize/<session>?code_challenge=…`: every OpenClaw host masks the value of
97
+ a query parameter named `session`, so the buyer opened `session=***` and sil-web said
98
+ `invalid_session`. `auth_url` and `session_id` are off the wire (contract §5) — the
99
+ plugin still mints the session id and claims with it.
100
+ - **`sil_whoami` carries the buyer's `country` inside `identity`**, beside `name`, when the
101
+ read has one — absent when nothing on file says it, never inferred from an address.
102
+ - **BREAKING — `shopping_search` and `shopping_offers` name the brief.** `brief` is
103
+ required on both, and sil records the call against the want behind it. The search
104
+ carries the brief's product specs, written FROM the brief's — all of them, the same
105
+ ones. The offers carry the brief and the picked ids and nothing else: sil reads the
106
+ `seller` specs, `country` among them, off the brief, and they never ride on the search.
107
+ `ship_to` stays what it was on the search, the label of an address that localizes and
108
+ rules no seller out — never a market filter. To change what is asked, change the brief
109
+ with the buyer's decision; a spec is never left out of one call.
110
+ - **BREAKING — the catalog answer is the agent contract's, and the pre-contract one is
111
+ deleted.** `shopping_search` takes `brief` · `domain` · `query` · `n` · `specs` ·
112
+ `ship_to` and
113
+ answers with `products[]`, each carrying `fit` (only what sil verified — a key absent
114
+ from it is a gap to name, never a miss), the `variants` that fit, a price range per
115
+ currency, and `host` · `printed` where the page was read in this request and sil does
116
+ not hold the product yet. It asks nothing about
117
+ sellers: the dossier, the offers with their seller terms, and one seller's whole terms
118
+ are three separate reads now. Nothing is projected on the way back.
119
+ - **The honesty vocabulary the agent reads.** `printed` and `host` on a search result, like
120
+ `webpage_info` on the dossier, are the shop's own words — a claim, not a reading; their
121
+ absence means sil read the page itself. An empty `variants` says no
122
+ listed option fits. A price in another currency is a bound sil could not test. On an
123
+ offer's `seller_fit`, `ships: unknown` keeps that offer and a requested seller key
124
+ absent is a term sil has not read — never a term the seller lacks.
125
+ - **The `≤4` search-call bound is PER CATEGORY**, not per request. On a brief covering
126
+ boots and a helmet the old reading either halved the second category's budget or blew
127
+ the bound.
128
+ - **`sil.search_results` carries the `shopping_search` body** (`{status, products}`). The
129
+ method name, its two-layer authz and its one not-found body are untouched.
130
+ - **`openclaw.build.openclawVersion` / `pluginSdkVersion` record `2026.9.3`**, the host
131
+ this plugin is verified against. Diagnostics only; the `compat` floor stays
132
+ `>=2026.7.1` — nothing here needs a newer API.
133
+ - **A category inherits every ancestor key and may RE-DECLARE one for its own subtree.**
134
+ `shopping_domain_create`'s description and the category reference carry the signed rule:
135
+ a key is never renamed; declaring an ancestor's key with another unit, allowed-value set
136
+ or variant/product mark makes that definition win below the new path, converting
137
+ nothing; declaring it with nothing the ancestor does not already say is not a second
138
+ coin — the mint answers `ok` and reports it `inherited: true`. The previous wording
139
+ ("the same type and unit is not coined again") read as a ban on declaring it at all.
140
+
141
+ ### Removed
142
+
143
+ - **BREAKING — the local document store, its four verbs and `shopping_brief_compile`.**
144
+ The buyer's brief and measurements live in sil's backend under their account, so the
145
+ plugin keeps NOTHING of theirs on the agent's disk: `shopping_doc_find` / `read` /
146
+ `write` / `remove` and `shopping_brief_compile` do not register, there is no
147
+ deprecation stub and no read path for the old store. `$SIL_DATA_DIR` holds
148
+ `tokens.json` and `config.json` alone, and `sil_doctor` no longer reports
149
+ `store.unreadable:*`. A `shopper/` folder an earlier version left behind is read by
150
+ nothing and can be deleted.
151
+ - **BREAKING — the shopper-creation ceremony, whole.** Gone: the
152
+ `sil-openclaw-create-shopper` bin and its engine, the onboarding ladder and its
153
+ per-search pitch, `sil_register`'s `next_step: "offer_shopper"` breadcrumb (contract
154
+ §5), and `sil_doctor`'s `creationEntrypoint` field and `creation.entrypoint_present`
155
+ finding. A shopping intent runs the loop on whatever agent holds the plugin, with
156
+ nothing to set up first.
157
+ - **BREAKING — `sil_search`, `sil_product_get`, `sil_stores`, `sil_domain_find`,
158
+ `sil_domain_create` and the four `sil_doc_*` verbs.** Renamed, never aliased: the old
159
+ names do not register, and there is no deprecation stub.
160
+ - **The hand-mirrored wire types and their four structural gates.** The response shape
161
+ lives in the committed artifact; a second copy in the plugin was the first thing to
162
+ drift from it. What survives is one 200 gate — a plain object stating `status: "ok"`.
163
+ - **The top-level `status` / `advisories` refusal.** `status` is on the API body now, and
164
+ the wiring advisory rides its OWN result block rather than a key beside the contract's,
165
+ so a catalog route adding a field is no longer a breaking change on this side.
166
+ - **The registry's retired vocabulary** — `maturity`, `unset`, `predicates`, `applied`,
167
+ `option_set`, `charged_currency`, `handoff`, `data_type`, `level`, `axis`, `capped`,
168
+ `validated_at`, `value_set` — gone from the wire, the skill and the drift guards.
169
+ - **BREAKING — `sil_learn`, `sil_profile_materialize`, `sil_profile_search`,
170
+ `sil_profile_get` and `sil_profile_remove`**, along with the local domain model they
171
+ addressed: `method.md`, intent-keyed PRDs, the `{domain, product, intent}` triple,
172
+ `attach-asset` and its MIME allowlist. The buying guide and its keys belong to the
173
+ shared registry; what is local is the person and their jobs.
174
+ - **The pre-contract request surface, outright.** Gone: `filters` (`category`,
175
+ `price_min`/`price_max`, `condition`, `available`), `local_merchants`, the `cursor`
176
+ pagination, `checkout_url`, `specs_status`, the `{ns, key}` spec path, `sil_specs` (its
177
+ route was removed server-side and every call had been failing), and every client-side
178
+ pre-flight validator behind them. Each route refuses before it spends and names the
179
+ offender in its own message, so a second validator here could only drift.
180
+
181
+ ### Fixed
182
+
183
+ - **The wiring-drift detector reads a 2026.8.1+ host's config.** That host's migration
184
+ renamed `agents.list` (an array) to `agents.entries` (a map keyed by id), and the
185
+ detector went blind on it — reporting a healthy install as mis-wired, or the reverse.
186
+ It reads both shapes now.
187
+ - **A delivery miss says WHICH callId and WHY, where an operator reads it.** The host
188
+ writes a plugin's structured fields to the log file and renders the console line from
189
+ the message alone, so a container log showed `[plugins] sil_search_results_miss` and
190
+ nothing else — no callId to join a client's pull onto the search that produced it.
191
+ Every marker now repeats its fields inline (`sil_search_results_miss callId=<id>
192
+ reason=expired found=false`), and a search whose page was never buffered logs
193
+ `sil_search_results_skipped callId=<id> reason=refused:<status>|no_principal|
194
+ no_products` at the buffer — the two states that are `ok` to the agent and
195
+ unresolvable to a client. The WIRE is untouched: `sil.search_results` still answers
196
+ one `not_found` body for unknown, expired, foreign and logged-out alike.
197
+
13
198
  ## [0.4.6] - 2026-07-24
14
199
 
15
200
  ### Fixed
package/README.md CHANGED
@@ -95,37 +95,11 @@ agent done — here's your checkout link, ready to pay:
95
95
 
96
96
  ## Turn your OpenClaw into your personal shopping expert
97
97
 
98
- So far your *general* agent did the shopping. Go one step further: create **one** persistent shopper that learns *you* once, then shops **any** niche like a specialist — it researches how to buy well in each niche the first time you shop it, and gets sharper every session.
98
+ So far your *general* agent did the shopping. Go one step further, with **nothing to set up**: install the plugin and the agent you already have shops **any** niche like a specialist, learning how to buy well in each one the first time you shop it and getting sharper every session.
99
99
 
100
- **Spec-Driven Shopping (SDS).** Say *"set up my shopper"* and the plugin runs a **light** interview (≤10 questions) to shape how it should behave (the persona) and capture your **cross-niche** facts and the rules it must never break — and that's the whole setup. **No niche is researched up front.** From then on you just shop. The first time you ask for something in a new niche it **classifies** what you're buying, **researches that niche deeply on the spot** (the full how-to-buy-well: fit, gearing, geometry, the trade-offs — announced, so you can correct it), and derives the **dimensions** every request in that niche is decomposed along — minting a reusable **domain**. Ask for that niche again and it reuses what it learned; ask for a new one and it learns that too, keeping *you* the same across all of them. On **every query** it refreshes the domain knowledge from the web, decomposes what you asked, and **learns your facts and taste as it goes** (your measurements, your budget, a brand you won't touch) — captured once, never re-asked. It recommends with a "why" that cites *what you asked*, *a fact it remembered*, and *a niche mechanic you'd never have named*. **Nothing is created until you say so**, and a second shopper is refused — there is exactly one of you. Creating and running it is local and offline, no sign-in required.
100
+ **Spec-Driven Shopping (SDS).** There is no setup step and no interview — just say what you want. The first time you ask for something in a new niche the plugin **classifies** what you're buying, **researches that niche deeply on the spot** (the full how-to-buy-well: fit, gearing, geometry, the trade-offs — announced, so you can correct it), and derives the **dimensions** every request in that niche is decomposed along, minting a reusable **domain**. Ask for that niche again and it reuses what it learned; ask for a new one and it learns that too, keeping *you* the same across all of them. On **every query** it reads sil's shared registry for how that category is bought, decomposes what you asked, and **learns your facts and taste as it goes** (your measurements, your budget, a brand you won't touch) — captured once, never re-asked. It recommends with a "why" that cites *what you asked*, *a fact it remembered*, and *a niche mechanic you'd never have named*.
101
101
 
102
- **1 — One light conversation creates your shopper (no niche research yet):**
103
-
104
- ```text
105
- you set up my shopper
106
-
107
- agent Love it — let's shape it lightly. Should it shop patient and
108
- thorough, or fast and decisive? Anything it must always do,
109
- or never do?
110
-
111
- you thorough, and never recommend anything I can't return
112
-
113
- agent Got it — I'll keep your cross-niche rules (free returns only)
114
- and learn each niche the first time you shop it. Nothing to
115
- research up front.
116
-
117
- Your Shopper — a thorough, returns-first buyer
118
- · learns any niche on first shop · keeps your facts across all of them
119
-
120
- shall I create it?
121
-
122
- you yes, create it
123
-
124
- agent done — your shopper is live. Just tell it what you want;
125
- it learns the niche on the fly.
126
- ```
127
-
128
- **2 — It learns a niche the first time you shop it, and keeps *you* across all of them:**
102
+ **It learns a niche the first time you shop it, and keeps *you* across all of them:**
129
103
 
130
104
  ```text
131
105
  you find me a road bike, ~€1500
@@ -153,37 +127,50 @@ agent Different niche — camping. Learning how to buy a backpacking
153
127
  returns rule carries straight over, no need to re-ask.
154
128
  ```
155
129
 
156
- > **You teach it once; it stays sharp.** It keeps your facts and taste, web-refreshes its niche knowledge each visit, and never re-asks what it already knows. See what your shopper knows and which domains it has learned, look at how a domain is set up, forget one you're done with — or **refine** the shopper or a domain from what it watched you reject, so it gets sharper every session.
130
+ > **You teach it once; it stays sharp.** How a category is bought comes from sil's shared registry — read before the web, so it is current without you teaching it twice — and your own facts, taste and shopping jobs belong to your sil account rather than to one agent. Nothing to re-answer, and sharper every session.
157
131
 
158
- **What it remembers, and where it lives.** Your shopper learns your shopping-relevant facts as it goes — measurements, budget band, the rules it must never break, brand likes/dislikes — captured **only when a request actually needs them** (never a big up-front form) so it doesn't re-ask. All of it is stored **locally on your machine** (`$SIL_DATA_DIR/shopper/`, owner-only `0600`), **per-user (one shopper, many domains)**. It is **never pooled across users and never sent to a server** for training or aggregation — creating and running your shopper is local and offline. The niche web-refresh reads public sources to keep the *domain* knowledge current; it does not upload anything about you. Inspect exactly what your shopper holds with `sil_profile_get`, and forget one domain it learned with `sil_profile_remove`.
132
+ **What it keeps on your machine: nothing of yours.** The plugin stores your sil credentials and its own configuration under `$SIL_DATA_DIR` (owner-only `0600`) and nothing else — no notes about you, no shopping jobs, no measurements. A shopping call reads that credential, rewrites it when sil refreshes it, and deletes it when the session is past refreshing. What your agent learns about you lives in your sil account, is **never pooled across users**, and is never used for training or aggregation. Research reads public sources to learn how a *category* is bought; it does not upload anything about you. If an earlier version left a `shopper/` folder under that directory, nothing reads it any more and you can delete it.
159
133
 
160
134
  ---
161
135
 
162
136
  ## Tools
163
137
 
164
- Namespaced `sil_*` so they never collide with other plugins. Your agent calls them for you — you just say what you want.
138
+ Fourteen tools. The eleven the shopping loop calls are named `shopping_*` — for what
139
+ they do for you — and the three account tools keep the `sil_` name. Your agent calls them
140
+ for you; you just say what you want.
165
141
 
166
- **Identity**
142
+ **Your account**
167
143
 
168
144
  | Tool | What it does |
169
145
  |---|---|
170
- | `sil_register` | Start a browser sign-in and link your agent to your sil identity. Returns an `auth_url` to open; once you've signed in, the agent is registered and can transact. Takes no arguments. |
171
- | `sil_whoami` | Read your sil identity — name and saved addresses — as the agent sees it. Takes no arguments. |
146
+ | `sil_register` | Start a browser sign-in and link your agent to your sil identity. Takes no arguments. |
147
+ | `sil_whoami` | Read your sil identity — name, country, the currency you price in, saved addresses, and the measurements and preferences sil holds for you — as the agent sees it. Takes no arguments. |
148
+ | `sil_doctor` | Check the install: file modes, credential health, host wiring, and whether a newer plugin is published. Reports; repairs only what is safe. |
172
149
 
173
- **Catalog**
150
+ **Your brief and your profile**
174
151
 
175
152
  | Tool | What it does |
176
153
  |---|---|
177
- | `sil_search` | Search for purchasable products. A free-text `query` plus optional filters: `category`, `price_min`/`price_max`, `ship_to` (delivery destination — leave empty to ship to your registered address), `condition` (`new` / `secondhand`), `available`, and `local_merchants` (best-effort bias toward shops in the user's own country). Results are **localized** to the shopper; when they ask for local shops you can *optionally* issue the `query` in that country's language to surface more of them (e.g. a French query surfaces French stores) — a tactic, not a requirement, and never an override of a language the user deliberately chose. Returns a ranked list of variants — each with `id`, `title`, `price`, `availability`, `checkout_url`, `source`, plus (where the source provides them) evaluate-before-buy detail: a product/variant `url` to view, a `description`, `media`, the product `options`, and the `seller`'s **shipping & return policy links** — and a pagination `cursor`. Location filters take ISO codes (`US`, `CA`), not place names. |
178
- | `sil_product_get` | Resolve `ids` you already hold to full products in UCP shape — `description`, `options`, `media`, the `seller`'s shipping & return policy links, and the featured purchasable variant with fresh `price`, `availability`, `url` (the page to view), and `checkout_url` (the link that buys). Re-fetch right before buying; those values are point-in-time, not guarantees. Ids that no longer resolve come back in `not_found`. |
154
+ | `shopping_brief_create` | Open the shopping job this conversation works from — a title and what you are after in your own words, plus any wants you have already stated. One brief per conversation, across every category it covers. |
155
+ | `shopping_brief_edit` | Write a want, a change of mind or the end of the job into that brief: the values you want under the category they belong to, the seller terms under `seller`, the keys you have given up, and one sentence saying what you changed and why. |
156
+ | `shopping_brief_read` | With no arguments, your shopping jobs, newest first — so a new chat carries on where the last one stopped. With an `id`, that whole brief: what you are after, every want under its category, and the decisions you have already taken. |
157
+ | `shopping_profile_edit` | Write what is true of you whatever you are buying: a measurement with its unit, a size as it is printed, a lasting taste in your own words, or the currency you price in. Writing the same name again replaces it; `sil_whoami` reads it all back. A new currency changes which offers come first, never a price: sil converts nothing. |
179
158
 
180
- **Your shopper** — create one shopper, then manage the domains it learns
159
+ **Shopping**
181
160
 
182
161
  | Tool | What it does |
183
162
  |---|---|
184
- | `sil_profile_materialize` | Write your shopper's behaviour artefacts under `$SIL_DATA_DIR/shopper/`. One tool, two modes: **create** your shopper (the shared, cross-niche `user_spec.md` + a `profile.json` manifest, no niche pack), or **mint/refresh a domain** the first time you shop a niche (that niche's `domain_spec.md` (deep researched niche expertise) + `intent_spec.md` (the decomposition-dimension schema) + `playbook.md` (your niche shopping taste), alongside the shared `user_spec.md`). (The persona is the agent's host workspace `SOUL.md`, not a sil artefact.) Validate-first and fail-closed; it never clobbers an existing domain, and a second shopper is refused. |
185
- | `sil_profile_get` | Show your shopper — with **no arguments**, the overview (`name`, the shared `userSpec`, the domain index of everything it has learned; an empty store is healthy); pass a `domainSlug` for one domain's `domainSpec` + `intentSpec` + `playbook`. |
186
- | `sil_profile_remove` | Forget ONE domain — pass its `domainSlug`; your shopper, your shared facts, and every other domain survive. Scoped and idempotent; the agent confirms with you before removing. |
163
+ | `shopping_domain_search` | Read sil's shared registry in your own words and get back the categories that match, each with a line on how the thing is bought. An empty list is the one answer that licenses a mint. |
164
+ | `shopping_domain_get` | Read one standing category: its buying guide, and every key it is bought by with the operators, unit and allowed values each takes. |
165
+ | `shopping_domain_create` | Coin a NEW category — its path, a guide written from research, and its first keys. The one permanent, global write in sil; an existing path is refused and nothing is written. |
166
+ | `shopping_search` | Search one settled category, under the brief this conversation is working from. Send the brief's id, the domain, your own shopping words, how many products you want, the brief's own values for that category as `specs`, and `ship_to` — the label of one of your saved addresses, which localizes the search (your default one when it is left off) and rules no seller out. Products come back best-first with `fit` (what sil verified), their variants, a price range, and `webpage_info` where sil has not read the page yet. |
167
+ | `shopping_product_get` | Open the whole of what sil holds on 1–10 shortlisted variants: the description, the images, every key sil holds, and where each reading came from and when. |
168
+ | `shopping_offers` | Price 1–10 picked variants live, on your own terms: send the brief's id and the variant ids, and sil reads the rest — the brief's `seller` terms and price ceiling, your default address and your currency. It looks on the web for shops it does not hold yet, and each offer comes back with the price exactly as the page prints it, its currency, availability, the listing URL, the moment sil read it, and `seller_fit` — whether that seller ships to your address (`serviceable`, `not_serviceable` or `unknown`) and what it holds for each term on the brief. Shops in your currency and market come first. |
169
+ | `shopping_seller_get` | One seller's whole terms, for 1–10 of them: `specs` (every seller key sil holds a value for), whether it ships to you, and the shipping routes and return terms sil has read. `unknown` keeps the seller; it just means sil has not read that policy. |
170
+
171
+ **The wire is a contract, not a convention.** Each shopping tool's input schema IS the
172
+ artifact under [`schema/`](./schema), copied verbatim from sil-services, and each answer
173
+ is the API's own 200 body handed over untouched.
187
174
 
188
175
  ---
189
176
 
@@ -191,10 +178,11 @@ Namespaced `sil_*` so they never collide with other plugins. Your agent calls th
191
178
 
192
179
  The plugin ships one bundled skill — **`sil-shopping`** 🛒 — that your agent loads automatically the first time you express a shopping intent. You don't invoke it; it's the playbook that makes the tools work well together:
193
180
 
194
- - **Routes intent to the right tool.** *"find me a keyboard"* → `sil_search`, *"look these up"* → `sil_product_get`, *"who am I?"* → `sil_whoami`, *"sign me up"* → `sil_register`, *"set up my shopper"* → the create flow, *"what does my shopper know / forget the grocery domain"* → the `sil_profile_*` tools.
195
- - **One shopper, many niches — minted on the fly.** Asked to set up shopping, it runs a short two-touchpoint onboarding (how your shopper should behave + your cross-niche facts and hard rules) and creates **one** shopper — creating nothing until you explicitly endorse the draft. From then on it shops *any* niche: it classifies what you're buying, reuses a niche it has already learned or **researches a new one on the spot** (announced, so you can correct it), and derives how to decompose every request — learning your facts and taste as it goes.
181
+ - **Routes intent to the right tool.** *"find me a keyboard"* → `shopping_search`, *"what does it cost?"* → `shopping_offers`, *"will it reach me?"* → `shopping_seller_get`, *"what was I shopping for?"* → `shopping_brief_read`, *"who am I?"* → `sil_whoami`, *"sign me up"* → `sil_register`.
182
+ - **Many niches, minted on the fly, with no preparation.** A shopping intent runs the loop on whatever agent holds the plugin: it classifies what you're buying, reuses a niche it has already learned or **researches a new one on the spot** (announced, so you can correct it), and derives how to decompose every request — learning your facts and taste as it goes.
196
183
  - **Recovers the right way.** Every tool reports a status; the skill follows that tool's own recovery hint — re-register, fix the query, or retry — instead of guessing a fix that won't work.
197
- - **Keeps prices honest.** It treats price, availability, and checkout links as point-in-time and re-checks an item right before you buy, so the link you get is the link you pay.
184
+ - **Keeps prices honest.** A price is dated only where sil dated it, so the skill re-reads an item's offers right before you buy and quotes the moment they were read.
185
+ - **Says what sil verified, and says the rest as what it is.** A key sil holds no value for is named as a gap, not passed off as a miss; a page sil has not read yet is quoted as the seller's own words; a seller sil knows nothing about keeps its place.
198
186
 
199
187
  Because the skill ships inside the plugin, installing the plugin installs the skill — there's nothing extra to set up.
200
188
 
@@ -215,7 +203,7 @@ pnpm test # vitest (unit + integration)
215
203
  pnpm typecheck # tsc --noEmit
216
204
  ```
217
205
 
218
- Releasing is two steps: `pnpm version <patch|minor|major>` (bump → sync manifest → cut changelog → test → tag → push), then `pnpm release` (build → pack → npm `sil-openclaw` + ClawHub `@4gpts/sil` — the same contents, re-packed under each registry's name). Release notes in [`CHANGELOG.md`](https://github.com/Context4GPTs/sil-openclaw/blob/main/CHANGELOG.md). Adding a tool is three steps, enforced by a drift-guard test.
206
+ Releasing is two steps: `pnpm version <patch|minor|major>` (bump → sync manifest → cut changelog → test → tag → push), then `pnpm release` (build → pack → **stage** on npm as `sil-openclaw` → a maintainer approves it with 2FA under npmjs.com's Staged Packages → the same contents to ClawHub as `@4gpts/sil`, only once npm serves them byte-identical). Staged publishing needs no 2FA-bypass token, which npm is retiring from publishing. Release notes in [`CHANGELOG.md`](https://github.com/Context4GPTs/sil-openclaw/blob/main/CHANGELOG.md). Adding a tool is three steps, enforced by a drift-guard test.
219
207
 
220
208
  ---
221
209
 
package/SECURITY.md CHANGED
@@ -3,8 +3,7 @@
3
3
  ## Reporting a vulnerability
4
4
 
5
5
  Report suspected vulnerabilities in `sil-openclaw` **privately — do not open a
6
- public issue**. Contact [@4gpts on X](https://x.com/4gpts) (this mirrors
7
- `openclaw.plugin.json#security.reportVulnerabilitiesTo`). We aim to acknowledge
6
+ public issue**. Contact [@4gpts on X](https://x.com/4gpts). We aim to acknowledge
8
7
  within a few business days and will coordinate a fix and disclosure timeline.
9
8
 
10
9
  ## Supported versions
@@ -14,14 +13,65 @@ backport fixes or maintain old release lines — upgrade to the latest version.
14
13
 
15
14
  ## What this plugin touches
16
15
 
17
- `register()` opens nothing — all I/O happens inside a tool's `execute()`. The
18
- plugin talks only to its two configured sil origins (`sil_web_url` for auth /
19
- token refresh, `sil_api_url` for identity + catalog reads) and stores
20
- credentials owner-only (`0600`) under the sil data directory. The PKCE verifier
21
- is held only in memory and never written to disk; tokens and identity PII are
16
+ Compiled JavaScript ships under `./dist`. No native modules, no install scripts,
17
+ no long-lived service, no inbound HTTP route.
18
+
19
+ **`register()` opens nothing.** It registers the tools and one gateway method,
20
+ ensures the data directory, and synchronously reads the tool request schemas
21
+ under `./schema` — tracked files inside the package. No network, timer or handle.
22
+ All network I/O happens inside a tool's `execute()`.
23
+
24
+ ### Network endpoints
25
+
26
+ The plugin talks to these hosts and no others:
27
+
28
+ - `https://sil.4gpts.com` — sil-web: registration and token refresh (`sil_web_url`).
29
+ - `https://sil-api.4gpts.com` — sil-api: identity, catalog, brief and profile (`sil_api_url`).
30
+ - `https://clawhub.ai` — one unauthenticated, read-only `GET` by `sil_doctor` of
31
+ the published `@4gpts/sil` version: no token, no PII, bounded timeout, redirects
32
+ refused, silent on any failure.
33
+
34
+ The `shopping_*` tools are read-only, except `shopping_domain_create` (writes one
35
+ registry row) and `shopping_brief_create` / `shopping_brief_edit` /
36
+ `shopping_profile_edit` (write the buyer's own brief and profile under their sil
37
+ account). On a `401`, every sil call refreshes once and retries once. A second
38
+ `401` or a dead refresh token clears `tokens.json`.
39
+
40
+ ### Filesystem and credentials
41
+
42
+ Everything lives under `$SIL_DATA_DIR` (default `$XDG_DATA_HOME/sil`, else
43
+ `~/.local/share/sil`), owner-only (files `0600`, dirs `0700`), written atomically
44
+ (tmp → rename → chmod):
45
+
46
+ - `tokens.json` — access and refresh token.
47
+ - `config.json` — user identity.
48
+
49
+ Nothing of the buyer's is kept on disk, and no caller-supplied value ever becomes
50
+ a path segment. The PKCE verifier stays in memory. Tokens and identity PII are
22
51
  never logged.
23
52
 
24
- The authoritative, machine-readable disclosure ships in the package manifest —
25
- `openclaw.plugin.json#security` — covering network endpoints, filesystem scope,
26
- credentials on disk, and the `noNativeModules` / `noChildProcess` /
27
- `noInstallScripts` guarantees. Review it before installing.
53
+ `sil_doctor` reads that directory's state and metadata. It decodes only the
54
+ access token's `exp` claim, locally, and never emits token bytes. It only ever
55
+ narrows a too-open mode and creates a missing data directory. To prove the
56
+ directory is writable it writes one empty `.doctor.<hex>.tmp` probe and unlinks
57
+ it. Anything that would change an existing file's bytes is reported, never run.
58
+ Symlinks inside the directory are reported, never chmod'd through.
59
+
60
+ ### Timers and processes
61
+
62
+ `sil_register` arms one bounded poll timer. It stops on the first terminal claim
63
+ outcome or at the session deadline. Any other timer is scoped to one call.
64
+
65
+ The plugin process spawns nothing. The shipped `scripts/allowlist-openclaw.mjs`
66
+ is operator-run, never a lifecycle hook. It calls the host's `openclaw config
67
+ validate` CLI and writes the host `openclaw.json` (with a `.bak`) to admit sil's
68
+ tools.
69
+
70
+ ### Gateway method
71
+
72
+ `sil.search_results` (scope `operator.read`, authorized by the host before the
73
+ handler runs) lets a paired client read back a `shopping_search` page by the
74
+ `callId` it saw. Pages live in an in-memory buffer: at most 32 of them, each
75
+ dropped 15 minutes after its search, never written to disk. A page is served only
76
+ to the sil account that produced it. An unknown, expired or foreign reference gets
77
+ one identical not-found body. No network call, no agent run.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * `sil.search_results` — the plugin-owned gateway method a paired client calls
3
- * to pull a `sil_search` page by the `callId` it already saw on the tool
3
+ * to pull a `shopping_search` page by the `callId` it already saw on the tool
4
4
  * identity frames.
5
5
  *
6
6
  * NOT a tool, which is why it lives outside `src/tools/`: it never reaches the
@@ -28,6 +28,7 @@
28
28
  * log marker, and nothing on the wire has a field, shape, or timing tell.
29
29
  */
30
30
  import { hasTokens, readConfig } from "../lib/credentials.js";
31
+ import { logSearchResults } from "../lib/search-results-log.js";
31
32
  import { getSearchResult, searchResultMiss } from "../lib/search-results-store.js";
32
33
  export const SEARCH_RESULTS_METHOD = "sil.search_results";
33
34
  /** The ONE failure body: unknown ≡ expired ≡ wrong-principal ≡ no live session.
@@ -54,7 +55,7 @@ export function registerSearchResultsMethod(api) {
54
55
  resolve(api, params, respond);
55
56
  }
56
57
  catch (err) {
57
- api.logger.error("sil_search_results_failed", {
58
+ logSearchResults(api, "error", "failed", {
58
59
  cause: err instanceof Error ? err.message : String(err),
59
60
  });
60
61
  respond(true, NOT_FOUND);
@@ -64,7 +65,7 @@ export function registerSearchResultsMethod(api) {
64
65
  function resolve(api, params, respond) {
65
66
  const callId = params["callId"];
66
67
  if (typeof callId !== "string" || callId.length === 0) {
67
- api.logger.info("sil_search_results_invalid", { reason: "invalid_call_id" });
68
+ logSearchResults(api, "info", "invalid", { reason: "invalid_call_id" });
68
69
  respond(true, INVALID_REQUEST);
69
70
  return;
70
71
  }
@@ -74,20 +75,23 @@ function resolve(api, params, respond) {
74
75
  // identity that produced it, never to the machine.
75
76
  const principal = hasTokens() ? readConfig()?.user?.id : undefined;
76
77
  if (principal === undefined) {
77
- api.logger.info("sil_search_results_miss", { found: false, reason: "no_principal" });
78
+ logSearchResults(api, "info", "miss", { callId, reason: "no_principal", found: false });
78
79
  respond(true, NOT_FOUND);
79
80
  return;
80
81
  }
81
82
  const page = getSearchResult(callId, principal);
82
83
  if (page === null) {
83
- api.logger.info("sil_search_results_miss", {
84
+ // One `lookup` answers both, so a null page always has a cause; the fallback keeps
85
+ // the line honest rather than naming a cause the store did not give.
86
+ logSearchResults(api, "info", "miss", {
87
+ callId,
88
+ reason: searchResultMiss(callId, principal) ?? "unattributed",
84
89
  found: false,
85
- reason: searchResultMiss(callId, principal),
86
90
  });
87
91
  respond(true, NOT_FOUND);
88
92
  return;
89
93
  }
90
- api.logger.info("sil_search_results_hit", { found: true, count: page.products.length });
94
+ logSearchResults(api, "info", "hit", { callId, count: page.products.length, found: true });
91
95
  // Handed over BY REFERENCE, aliasing the array the agent envelope already
92
96
  // serialized. Deliberate: both paths JSON-serialize immediately and neither
93
97
  // mutates, so a defensive clone would copy ~50 KB per resolve for nothing.
package/dist/index.js CHANGED
@@ -1,21 +1,23 @@
1
1
  /**
2
2
  * sil OpenClaw plugin — entry point.
3
3
  *
4
- * A UCP commerce plugin for sil. It registers its real tool groups —
5
- * identity (`sil_register`, `sil_whoami`) and catalog (`sil_search`,
6
- * `sil_product_get`) — so they load in an OpenClaw host. There is no
7
- * transport, no persistent service, and no background work at register
8
- * time — `register()` is strictly synchronous and opens nothing.
4
+ * A UCP commerce plugin for sil. It registers its real tool groups — the account
5
+ * tools (`sil_register`, `sil_whoami`, `sil_doctor`) and the eleven `shopping_*`
6
+ * catalog tools — so they load in an OpenClaw host.
7
+ * There is no transport, no persistent service, and no background work at
8
+ * register time — `register()` is strictly synchronous and opens nothing.
9
9
  *
10
10
  * `register()` MUST stay synchronous and side-effect-free beyond
11
- * registering tools, ensuring the data dir, and logging. The reference
12
- * adapter (`klodi-plugin/adapters/openclaw`) carries a smoke gate
13
- * precisely because an eager connection opened in `register()` once held
14
- * the host's install subprocess event loop open and blocked gateway
15
- * startup. Keep it that way: all I/O lives inside a tool's `execute()` —
16
- * no timers, no sockets, no unawaited promises here. The one synchronous
17
- * `mkdirSync` (via `ensureDataDir()`) is exempt: it returns immediately
18
- * and holds no resource open.
11
+ * registering tools, ensuring the data dir, reading the shopping
12
+ * artifacts, and logging. The reference adapter
13
+ * (`klodi-plugin/adapters/openclaw`) carries a smoke gate precisely
14
+ * because an eager connection opened in `register()` once held the host's
15
+ * install subprocess event loop open and blocked gateway startup. Keep it
16
+ * that way: all NETWORK I/O lives inside a tool's `execute()` — no timers,
17
+ * no sockets, no unawaited promises here. Two synchronous filesystem reads
18
+ * are exempt because they return immediately and hold no resource open:
19
+ * `ensureDataDir()`'s `mkdirSync`, and the `readFileSync` each artifact-backed
20
+ * tool makes to publish its request artifact as its `parameters`.
19
21
  *
20
22
  * To add a tool, see `src/tools/identity.ts` (the reference group — it
21
23
  * sets the `jsonResult` success shape and structured-error envelope every
@@ -29,7 +31,6 @@ import { detectWiringDrift, readSilWiringFacts } from "./lib/host-wiring.js";
29
31
  import { registerCatalogTools } from "./tools/catalog.js";
30
32
  import { registerDoctorTools } from "./tools/doctor.js";
31
33
  import { registerIdentityTools } from "./tools/identity.js";
32
- import { registerProfileTools } from "./tools/profile.js";
33
34
  export default definePluginEntry({
34
35
  id: "sil",
35
36
  name: "sil",
@@ -38,10 +39,10 @@ export default definePluginEntry({
38
39
  register(api) {
39
40
  applyPluginConfigOverrides(api.pluginConfig);
40
41
  // Guarantee the data home exists from the instant register() returns — not
41
- // lazily on first write — so tokens, config, and SDS profile artefacts have
42
- // one consistent home from load. One-shot synchronous mkdir (recursive,
43
- // 0700): it returns immediately and holds no resource open, so the
44
- // register()-stays-synchronous / opens-nothing invariant is preserved.
42
+ // lazily on first write — so tokens and config have one consistent home from
43
+ // load. One-shot synchronous mkdir (recursive, 0700): it returns immediately
44
+ // and holds no resource open, so the register()-stays-synchronous /
45
+ // opens-nothing invariant is preserved.
45
46
  //
46
47
  // Fail-closed: an uncreatable home (parent unwritable, path occupied by a
47
48
  // file → ENOTDIR, no space) is logged LOUDLY and DISTINCTLY (the path + OS
@@ -56,10 +57,10 @@ export default definePluginEntry({
56
57
  catch (err) {
57
58
  const cause = err instanceof Error ? err.message : String(err);
58
59
  api.logger.error("sil_plugin_data_dir_failed", {
59
- message: "sil could NOT create its data directory at registration, so tokens,"
60
- + " config, and profiles have no home. Fix the data directory (it must"
61
- + " be writable — check permissions / free space / that $SIL_DATA_DIR"
62
- + " is a directory), then reload the plugin.",
60
+ message: "sil could NOT create its data directory at registration, so its tokens"
61
+ + " and config have no home. Fix the data directory (it must be writable"
62
+ + " — check permissions / free space / that $SIL_DATA_DIR is a"
63
+ + " directory), then reload the plugin.",
63
64
  data_dir: getDataDir(),
64
65
  cause,
65
66
  });
@@ -67,12 +68,11 @@ export default definePluginEntry({
67
68
  }
68
69
  registerIdentityTools(api);
69
70
  registerCatalogTools(api);
70
- registerProfileTools(api);
71
71
  registerDoctorTools(api);
72
72
  // The pull surface a paired client resolves a search page from. Registering
73
73
  // a closure opens nothing — no socket, no timer — so the invariant above
74
74
  // holds; the store behind it is touched only inside the handler and inside
75
- // sil_search's execute(). NOT a tool and NOT a `registerXTools` group: it
75
+ // shopping_search's execute(). NOT a tool and NOT a `registerXTools` group: it
76
76
  // never reaches the model, and the manifest's `contracts` vocabulary has no
77
77
  // gateway-method key, so this call IS the declaration.
78
78
  registerSearchResultsMethod(api);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The absolute path of the shipped tool-admission script, for prose telling an operator to
3
+ * run it: a bare bin name reaches PATH only on an npm-global install, and node normalizes a
4
+ * `..` hop through the host's skill SYMLINK lexically. `import.meta.url` is the sound root.
5
+ */
6
+ import { dirname, join } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ export const ALLOWLIST_SCRIPT_RELATIVE = "scripts/allowlist-openclaw.mjs";
9
+ /** Two levels up reaches the plugin root from both `src/lib/` and `dist/lib/`. */
10
+ const PLUGIN_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
11
+ export function resolveAllowlistScript() {
12
+ return join(PLUGIN_ROOT, ALLOWLIST_SCRIPT_RELATIVE);
13
+ }